﻿using B.S.Shop.Application.Command;
using B.S.Shop.Domain;
using B.S.Shop.ErrorCode;
using B.S.Shop.Infartructrue.Implment;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Shop.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ShopController : ControllerBase
    {
        public ShopController(IMediator mediator,ILogger<ShopController> logger)
        {
            Mediator = mediator;
            Logger = logger;
        }

        public IMediator Mediator { get; }
        public ILogger<ShopController> Logger { get; }
        [HttpDelete]
        public async Task<APIResult<int>> ShopDel(ShopDelCommand request )
        {
            Logger.LogInformation("删除订单成功");
          return await Mediator.Send(request);
        }
        [HttpGet]
        public async Task<APIResult<APIPageing<List<ShopClass>>>> ShopQuery([FromQuery]ShopQueryCommand request )
        {
            Logger.LogInformation("查询订单列表成功");
            return await Mediator.Send(request);
        }
        [HttpPost]
        public async Task<APIResult<int>> ShopCreate(ShopCreateCommand request )
        {
            Logger.LogInformation("创建订单成功");
            return await Mediator.Send(request);
        }
        [HttpPut]
        public async Task<APIResult<int>> ShopSheng(ShopUpdateRangeCommand request )
        {

            Logger.LogInformation("审核成功成功");
            return await Mediator.Send(request);
        }
        [HttpGet]
        public async Task<APIResult<List<BossClass>>> BossQuery([FromQuery]BossQueryCommand request )
        {
            Logger.LogInformation("查询供应商列表成功");
            return await Mediator.Send(request);
        }
        [HttpGet]
        public async Task<APIResult<List<ShopNameClass>>> ShopNameQuery([FromQuery]ShopNameQueryCommand request )
        {
            Logger.LogInformation("查询负责人列表成功");
            return await Mediator.Send(request);
        }
        [HttpGet]
        public async Task<APIResult<List<OrderClass>>> OrderQuery([FromQuery]OrderQueryCommand request )
        {
            Logger.LogInformation("查询商品列表成功");
            return await Mediator.Send(request);
        }
        [HttpPut]
        public async Task<APIResult<int>> OrderUpdate(OrderUpdateCommand request )
        {
            Logger.LogInformation("修改商品列表成功");
            return await Mediator.Send(request);
        }
        [HttpGet]
        public async Task<APIResult<List<OrderClass>>> ShopIsShow([FromQuery]OderIsShowQueryCommand request )
        {
            Logger.LogInformation("查询商品列表成功");
            return await Mediator.Send(request);
        }
    }
}
